﻿#region Copyright

//  ======================================================
//      Copyright (c) 2011 Toulr All rights reserved.
//     
//      The use and distribution terms for this software are contained in the file
//      named license.txt, which can be found in the root of this distribution.
//      By using this software in any fashion, you are agreeing to be bound by the
//      terms of this license.
//     
//     You must not remove this notice, or any other, from this software.
//  ======================================================

#endregion

#region Using Namespaces

using System;
using System.Collections.Generic;
using Toulr.Domains;
using Toulr.Domains.Account;
using Toulr.Domains.Business;
using Toulr.Models;
using Toulr.Models.Account;

#endregion

namespace Toulr.Services
{
    /// <summary>
    ///   用户相关信息维护及操作服务接口定义
    /// </summary>
    public interface IUserContextService : IApplicationContextService
    {
        Repository<User> Repository { get; set; }

        ///<summary>
        ///  根据提供的信息进行登录校验
        ///</summary>
        ///<param name = "loginModel">用户登录模型.</param>
        ///<returns></returns>
        ActionResult<User> Login(LoginModel loginModel);

        /// <summary>
        ///   用户注册
        /// </summary>
        ActionResult<bool> Register(RegisterModel registerModel);
        /// <summary>
        /// Forgets the password.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        /// <Author>Tecky Lee</Author>
        /// <Date>2011/5/26 20:07</Date>
        ActionResult<bool> ForgetPassword(string email);
        /// <summary>
        ///   用户修改密码
        /// </summary>
        ActionResult<bool> ChanagePassword(ChanagePasswordModel chanagePasswordModel);

        /// <summary>
        ///   修改用户基本信息
        /// </summary>
        ActionResult<User> Modify(ModifyModel modifyModel);

        /// <summary>
        ///   校验邮件地址
        /// </summary>
        ActionResult<bool> VerifyEmail(String verifyCode);

        /// <summary>
        /// 发送校验邮件
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="baseUrl">The base URL.</param>
        /// <returns></returns>
        ActionResult<bool> SendVerifyMail(String email,string baseUrl);

        /// <summary>
        /// Verifies the email link.
        /// </summary>
        /// <param name="emailIdentifyCode">The email identify code.</param>
        /// <param name="timeIdentifyCode">The time identify code.</param>
        /// <returns></returns>
        /// <Author>Tecky Lee</Author>
        /// <Date>2011/5/24 19:48</Date>
        ActionResult<string> VerifyEmailLink(string emailIdentifyCode, string timeIdentifyCode);

        /// <summary>
        ///   向指定手机发送校验码
        /// </summary>
        ActionResult<String> SendVerifyCode(String phone);

        /// <summary>
        ///   校验手机信息
        /// </summary>
        ActionResult<bool> VerifyMobilePhone(string email, String verifyCode);

        /// <summary>
        ///   删除指定电子邮件所对应的用户
        /// </summary>
        ActionResult<bool> DeleteUser(String email);

        /// <summary>
        ///   检查指定的Email是否已经注册过
        /// </summary>
        ActionResult<bool> EmailRegistered(String email);

        /// <summary>
        ///   读取指定用户的短消息
        /// </summary>
        ActionResult<List<Messages>> GetMessages(int userId);

        /// <summary>
        ///   读取指定用户发送过的短消息
        /// </summary>
        ActionResult<List<Messages>> GetSentMessages(int userId);

        /// <summary>
        ///   发送消息
        /// </summary>
        ActionResult<Boolean> SendMessage(String msg, int fromUser, int toUser);

        /// <summary>
        ///   获取指定用户的好友列表
        /// </summary>
        ActionResult<List<Friends>> GetFriends(int userId);

        /// <summary>
        ///   批量删除好友
        /// </summary>
        ActionResult<bool> RemoveFriends(IList<int> friendses);

        /// <summary>
        ///   添加好友
        /// </summary>
        ActionResult<bool> AddFriend(int fromUser, int toUser, String requestMsg);

        /// <summary>
        ///   确认好友关系
        /// </summary>
        ActionResult<bool> ConfirmFriend(int friendId);

        /// <summary>
        ///   拒绝好友关系申请
        /// </summary>
        ActionResult<bool> RejectFriend(int friendId);

        /// <summary>
        ///   获取用户账单信息
        /// </summary>
        ActionResult<List<Bill>> GetBillHistory(int uid);

        /// <summary>
        /// Encodes the user account info for cookie.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        /// <Author>Tecky Lee</Author>
        /// <Date>2011/5/25 20:49</Date>
        ActionResult<string> EncodeUserInfoForCookie(string email, string pwd);
        ActionResult<User> LoginWithCookieIndentyString(string cookieUserInfo);
    }
}